package util;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBConn {
    private static Connection conn = null;
    public static Connection getConnection(String url) {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection(url, "root", "root");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return conn;
    }

    public static void closeConnection() throws Exception {
        if (conn != null && !conn.isClosed())
            conn.close();
    }
}
